﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DownloadInterface;

using System.Windows.Forms;
namespace WpfApplication2
{
    /// <summary>
    /// DialogWindow.xaml 的交互逻辑
    /// </summary>
    public partial class DialogWindow : Window
    {
        private DownloadTask task;
        public DialogWindow(DownloadTask newtask)
        {
            InitializeComponent();
            task = newtask;
            dialogGrid.DataContext = task;
            
        }
        public void SetCategory(IEnumerable<FileCategory> categoryList)
        {
            //comboBox1.ItemsSource = categoryList;
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            BindingExpression bindingExpressionName = BindingOperations.GetBindingExpression(textBox1,System.Windows.Controls.TextBox.TextProperty);
            bindingExpressionName.UpdateSource();
            BindingExpression bindingExpressionName2 = BindingOperations.GetBindingExpression(textBox2, System.Windows.Controls.TextBox.TextProperty);
            bindingExpressionName2.UpdateSource();

            this.DialogResult = true;
        }

        private void ChangePath_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog s = new FolderBrowserDialog();
            s.ShowDialog();
            ShowPath.Content =s.SelectedPath;
            task.filePath = s.SelectedPath;
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            task.fileName = null;
        }


    }
}
